/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package isi.corba.gui;


import javax.swing.JOptionPane;
import org.omg.CosNaming.*;
import org.omg.CORBA.*;

/**
 *
 * @author jof
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        // initialisation de corba

        try {
            // create and initialize the ORB
            ORB orb = ORB.init(args, null);

            // get the root naming context
            org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
            final NamingContext ncRef = NamingContextHelper.narrow(objRef);

            if(ncRef==null) {
                System.out.println("na null");
            }
            
            java.awt.EventQueue.invokeLater(new Runnable() {

                public void run() {
                    MainFrame fenetrePrincipale = new MainFrame(ncRef);

                    fenetrePrincipale.setLocationRelativeTo(null);
                    fenetrePrincipale.setVisible(true);
                }
            });

        } catch (Exception e) {
            //System.out.println("ERROR : " + e) ;
            //e.printStackTrace(System.out);
            JOptionPane.showMessageDialog(null, "Erreur: ORB non lancé ?");
        }

           


       
    }

}
